/*
 * @Author: your name
 * @Date: 2021-01-11 17:47:39
 * @LastEditTime: 2021-01-14 10:08:00
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \shopping\src\api\index.js
 */
import request from '@/utils/request.js'

export const getSwiperData = () => {
    return request({
        method: 'get',
        url: '/home/swiperdata'
    })
}

export const getNavData = () => {
    return request({
        url: '/home/catitems'
    })
}

export const getFloorData = () => {
    return request({
        url: '/home/floordata'
    })
}

// 获取商品分类列表
export const getCategoryList = () => {
    return request({
        url: "/categories"
    })
}

// 获取商品列表
export const getGoodsList = (data) => {
    return request({
        url: "/goods/search",
        data
    })
}

// 获取商品详情
export const getGoodsDetail = (data) => {
    return request({
        url: "/goods/detail",
        data
    })
}

// 登录获取token
export const wxLoign = (data) => {
    return request({
        url: "/users/wxlogin",
        data,
        method: 'post'
    })
}

// 创建订单
export const createOrder = (data) => {
    return request({
        url: "/my/orders/create",
        data,
        method: 'post'
    })
}

// 获取支付参数
export const getPayParams  = (data) => {
    return request({
        url: "/my/orders/req_unifiedorder",
        data,
        method: 'post'
    })
}
// 检查订单的支付状态
export const checkOrder  = (data) => {
    return request({
        url: "/my/orders/chkOrder",
        data,
        method: 'post'
    })
}

// 历史订单查询
export const getOrders   = (data) => {
    return request({
        url: "/my/orders/all",
        data,
    })
}


